connector Pin
  Real v;
  flow Real i;
end Pin;

 connector PositivePin
    Real v;
    flow Real i;
  end PositivePin;

  connector NegativePin
    Real v;
    flow Real i;
  end NegativePin;

  model TwoPin
    Real v;
    PositivePin p;
    NegativePin n;
  equation
    v = p.v-n.v;
  end TwoPin;

  model OnePort
    Real v;
    Real i;
    PositivePin p;
    NegativePin n;
  equation
    v = p.v-n.v;
    0 = p.i+n.i;
    i = p.i;
  end OnePort;

  model Resistor
  extends OnePort;
    parameter Real R=1;
  equation
    R*i = v;
  end Resistor;

  model Capacitor
  extends OnePort;
    parameter Real C=1;
  equation
    i = C*der(v);
  end Capacitor;

  model Inductor
  extends OnePort;
    parameter Real L=1;
  equation
    L*der(i) = v;
  end Inductor;

  model ConstantVoltage
  extends OnePort;
    parameter Real V=1;
  equation
    v = V;
  end ConstantVoltage;

  model Ground
    Pin p;
  equation
    p.v = 0;
  end Ground;
  model BaseCircuit
    ConstantVoltage cv;
    Ground g;
    Inductor c_1_1;
    Capacitor c_1_2;
    Inductor c_1_3;
    Capacitor c_1_4;
    Inductor c_1_5;
    Resistor c_1_6;
    Capacitor c_1_7;
    Capacitor c_1_8;
    Capacitor c_1_9;
    Inductor c_1_10;
    Resistor c_2_1;
    Resistor c_2_2;
    Capacitor c_2_3;
    Resistor c_2_4;
    Inductor c_2_5;
    Resistor c_2_6;
    Capacitor c_2_7;
    Capacitor c_2_8;
    Resistor c_2_9;
    Inductor c_2_10;
    Capacitor c_2_11;
    Capacitor c_3_1;
    Inductor c_3_2;
    Resistor c_3_3;
    Resistor c_3_4;
    Inductor c_3_5;
    Inductor c_3_6;
    Capacitor c_3_7;
    Capacitor c_3_8;
    Inductor c_3_9;
    Inductor c_3_10;
    Resistor c_4_1;
    Capacitor c_4_2;
    Capacitor c_4_3;
    Resistor c_4_4;
    Inductor c_4_5;
    Resistor c_4_6;
    Capacitor c_4_7;
    Resistor c_4_8;
    Capacitor c_4_9;
    Capacitor c_4_10;
    Capacitor c_4_11;
    Inductor c_5_1;
    Capacitor c_5_2;
    Resistor c_5_3;
    Capacitor c_5_4;
    Resistor c_5_5;
    Inductor c_5_6;
    Resistor c_5_7;
    Inductor c_5_8;
    Capacitor c_5_9;
    Capacitor c_5_10;
    Resistor c_6_1;
    Capacitor c_6_2;
    Resistor c_6_3;
    Capacitor c_6_4;
    Capacitor c_6_5;
    Inductor c_6_6;
    Inductor c_6_7;
    Capacitor c_6_8;
    Inductor c_6_9;
    Capacitor c_6_10;
    Capacitor c_6_11;
    Resistor c_7_1;
    Resistor c_7_2;
    Capacitor c_7_3;
    Inductor c_7_4;
    Capacitor c_7_5;
    Resistor c_7_6;
    Resistor c_7_7;
    Capacitor c_7_8;
    Inductor c_7_9;
    Inductor c_7_10;
    Capacitor c_8_1;
    Capacitor c_8_2;
    Inductor c_8_3;
    Inductor c_8_4;
    Resistor c_8_5;
    Inductor c_8_6;
    Capacitor c_8_7;
    Inductor c_8_8;
    Resistor c_8_9;
    Resistor c_8_10;
    Capacitor c_8_11;
    Resistor c_9_1;
    Resistor c_9_2;
    Capacitor c_9_3;
    Inductor c_9_4;
    Resistor c_9_5;
    Capacitor c_9_6;
    Inductor c_9_7;
    Capacitor c_9_8;
    Resistor c_9_9;
    Inductor c_9_10;
    Inductor c_10_1;
    Inductor c_10_2;
    Capacitor c_10_3;
    Capacitor c_10_4;
    Inductor c_10_5;
    Resistor c_10_6;
    Capacitor c_10_7;
    Inductor c_10_8;
    Capacitor c_10_9;
    Resistor c_10_10;
    Inductor c_10_11;
    Capacitor c_11_1;
    Inductor c_11_2;
    Inductor c_11_3;
    Capacitor c_11_4;
    Resistor c_11_5;
    Capacitor c_11_6;
    Capacitor c_11_7;
    Resistor c_11_8;
    Inductor c_11_9;
    Capacitor c_11_10;
  equation
    connect(cv.p,c_1_1.p);
    connect(cv.n,g.p);
    connect(g.p,c_11_1.n);
    connect(c_1_1.n,c_1_2.p);
    connect(c_1_2.n,c_1_3.p);
    connect(c_1_3.n,c_1_4.p);
    connect(c_1_4.n,c_1_5.p);
    connect(c_1_5.n,c_1_6.p);
    connect(c_1_6.n,c_1_7.p);
    connect(c_1_7.n,c_1_8.p);
    connect(c_1_8.n,c_1_9.p);
    connect(c_1_9.n,c_1_10.p);
    connect(c_3_1.n,c_3_2.p);
    connect(c_3_2.n,c_3_3.p);
    connect(c_3_3.n,c_3_4.p);
    connect(c_3_4.n,c_3_5.p);
    connect(c_3_5.n,c_3_6.p);
    connect(c_3_6.n,c_3_7.p);
    connect(c_3_7.n,c_3_8.p);
    connect(c_3_8.n,c_3_9.p);
    connect(c_3_9.n,c_3_10.p);
    connect(c_5_1.n,c_5_2.p);
    connect(c_5_2.n,c_5_3.p);
    connect(c_5_3.n,c_5_4.p);
    connect(c_5_4.n,c_5_5.p);
    connect(c_5_5.n,c_5_6.p);
    connect(c_5_6.n,c_5_7.p);
    connect(c_5_7.n,c_5_8.p);
    connect(c_5_8.n,c_5_9.p);
    connect(c_5_9.n,c_5_10.p);
    connect(c_7_1.n,c_7_2.p);
    connect(c_7_2.n,c_7_3.p);
    connect(c_7_3.n,c_7_4.p);
    connect(c_7_4.n,c_7_5.p);
    connect(c_7_5.n,c_7_6.p);
    connect(c_7_6.n,c_7_7.p);
    connect(c_7_7.n,c_7_8.p);
    connect(c_7_8.n,c_7_9.p);
    connect(c_7_9.n,c_7_10.p);
    connect(c_9_1.n,c_9_2.p);
    connect(c_9_2.n,c_9_3.p);
    connect(c_9_3.n,c_9_4.p);
    connect(c_9_4.n,c_9_5.p);
    connect(c_9_5.n,c_9_6.p);
    connect(c_9_6.n,c_9_7.p);
    connect(c_9_7.n,c_9_8.p);
    connect(c_9_8.n,c_9_9.p);
    connect(c_9_9.n,c_9_10.p);
    connect(c_11_1.n,c_11_2.p);
    connect(c_11_2.n,c_11_3.p);
    connect(c_11_3.n,c_11_4.p);
    connect(c_11_4.n,c_11_5.p);
    connect(c_11_5.n,c_11_6.p);
    connect(c_11_6.n,c_11_7.p);
    connect(c_11_7.n,c_11_8.p);
    connect(c_11_8.n,c_11_9.p);
    connect(c_11_9.n,c_11_10.p);
    connect(c_2_1.p,c_1_1.p);
    connect(c_2_1.n,c_3_1.p);
    connect(c_2_2.p,c_1_2.p);
    connect(c_2_2.n,c_3_2.p);
    connect(c_2_3.p,c_1_3.p);
    connect(c_2_3.n,c_3_3.p);
    connect(c_2_4.p,c_1_4.p);
    connect(c_2_4.n,c_3_4.p);
    connect(c_2_5.p,c_1_5.p);
    connect(c_2_5.n,c_3_5.p);
    connect(c_2_6.p,c_1_6.p);
    connect(c_2_6.n,c_3_6.p);
    connect(c_2_7.p,c_1_7.p);
    connect(c_2_7.n,c_3_7.p);
    connect(c_2_8.p,c_1_8.p);
    connect(c_2_8.n,c_3_8.p);
    connect(c_2_9.p,c_1_9.p);
    connect(c_2_9.n,c_3_9.p);
    connect(c_2_10.p,c_1_10.p);
    connect(c_2_10.n,c_3_10.p);
    connect(c_2_11.p,c_1_10.n);
    connect(c_2_11.n,c_3_10.n);
    connect(c_4_1.p,c_3_1.p);
    connect(c_4_1.n,c_5_1.p);
    connect(c_4_2.p,c_3_2.p);
    connect(c_4_2.n,c_5_2.p);
    connect(c_4_3.p,c_3_3.p);
    connect(c_4_3.n,c_5_3.p);
    connect(c_4_4.p,c_3_4.p);
    connect(c_4_4.n,c_5_4.p);
    connect(c_4_5.p,c_3_5.p);
    connect(c_4_5.n,c_5_5.p);
    connect(c_4_6.p,c_3_6.p);
    connect(c_4_6.n,c_5_6.p);
    connect(c_4_7.p,c_3_7.p);
    connect(c_4_7.n,c_5_7.p);
    connect(c_4_8.p,c_3_8.p);
    connect(c_4_8.n,c_5_8.p);
    connect(c_4_9.p,c_3_9.p);
    connect(c_4_9.n,c_5_9.p);
    connect(c_4_10.p,c_3_10.p);
    connect(c_4_10.n,c_5_10.p);
    connect(c_4_11.p,c_3_10.n);
    connect(c_4_11.n,c_5_10.n);
    connect(c_6_1.p,c_5_1.p);
    connect(c_6_1.n,c_7_1.p);
    connect(c_6_2.p,c_5_2.p);
    connect(c_6_2.n,c_7_2.p);
    connect(c_6_3.p,c_5_3.p);
    connect(c_6_3.n,c_7_3.p);
    connect(c_6_4.p,c_5_4.p);
    connect(c_6_4.n,c_7_4.p);
    connect(c_6_5.p,c_5_5.p);
    connect(c_6_5.n,c_7_5.p);
    connect(c_6_6.p,c_5_6.p);
    connect(c_6_6.n,c_7_6.p);
    connect(c_6_7.p,c_5_7.p);
    connect(c_6_7.n,c_7_7.p);
    connect(c_6_8.p,c_5_8.p);
    connect(c_6_8.n,c_7_8.p);
    connect(c_6_9.p,c_5_9.p);
    connect(c_6_9.n,c_7_9.p);
    connect(c_6_10.p,c_5_10.p);
    connect(c_6_10.n,c_7_10.p);
    connect(c_6_11.p,c_5_10.n);
    connect(c_6_11.n,c_7_10.n);
    connect(c_8_1.p,c_7_1.p);
    connect(c_8_1.n,c_9_1.p);
    connect(c_8_2.p,c_7_2.p);
    connect(c_8_2.n,c_9_2.p);
    connect(c_8_3.p,c_7_3.p);
    connect(c_8_3.n,c_9_3.p);
    connect(c_8_4.p,c_7_4.p);
    connect(c_8_4.n,c_9_4.p);
    connect(c_8_5.p,c_7_5.p);
    connect(c_8_5.n,c_9_5.p);
    connect(c_8_6.p,c_7_6.p);
    connect(c_8_6.n,c_9_6.p);
    connect(c_8_7.p,c_7_7.p);
    connect(c_8_7.n,c_9_7.p);
    connect(c_8_8.p,c_7_8.p);
    connect(c_8_8.n,c_9_8.p);
    connect(c_8_9.p,c_7_9.p);
    connect(c_8_9.n,c_9_9.p);
    connect(c_8_10.p,c_7_10.p);
    connect(c_8_10.n,c_9_10.p);
    connect(c_8_11.p,c_7_10.n);
    connect(c_8_11.n,c_9_10.n);
    connect(c_10_1.p,c_9_1.p);
    connect(c_10_1.n,c_11_1.p);
    connect(c_10_2.p,c_9_2.p);
    connect(c_10_2.n,c_11_2.p);
    connect(c_10_3.p,c_9_3.p);
    connect(c_10_3.n,c_11_3.p);
    connect(c_10_4.p,c_9_4.p);
    connect(c_10_4.n,c_11_4.p);
    connect(c_10_5.p,c_9_5.p);
    connect(c_10_5.n,c_11_5.p);
    connect(c_10_6.p,c_9_6.p);
    connect(c_10_6.n,c_11_6.p);
    connect(c_10_7.p,c_9_7.p);
    connect(c_10_7.n,c_11_7.p);
    connect(c_10_8.p,c_9_8.p);
    connect(c_10_8.n,c_11_8.p);
    connect(c_10_9.p,c_9_9.p);
    connect(c_10_9.n,c_11_9.p);
    connect(c_10_10.p,c_9_10.p);
    connect(c_10_10.n,c_11_10.p);
    connect(c_10_11.p,c_9_10.n);
    connect(c_10_11.n,c_11_10.n);
  end BaseCircuit;
model Electrical
  BaseCircuit bc;
end Electrical;

